package com.konyo.web;

public enum ApiCode {
    // 通用
    FAILED(false, 0, "操作失败！"),
    //系统级
    SUCCESS(true, 0, "成功");
    private BaseResponse baseResponse;

    public BaseResponse getBaseResponse() {
        this.baseResponse = new BaseResponse(baseResponse.getCode(), baseResponse.getMessage(), baseResponse.getSuccess());
        baseResponse.setData("无返回数据项");
        return baseResponse;
    }

    public BaseResponse getBaseResponse(Object data) {
        this.baseResponse = new BaseResponse(baseResponse.getCode(), baseResponse.getMessage(), baseResponse.getSuccess());
        baseResponse.setData(data);
        return baseResponse;
    }

    public BaseResponse getBaseResponse(Object data, String message) {
        this.baseResponse = new BaseResponse(baseResponse.getCode(), message, baseResponse.getSuccess());
        baseResponse.setData(data);
        return baseResponse;
    }

    ApiCode(boolean success, int statusCode, String message) {
        this.baseResponse = null;
        this.baseResponse = new BaseResponse(statusCode, message, success);
    }
}
